/**********************************************************************
 *
 * $RCSfile: EventPublishTool.java,v $  $Revision: 1.5 $  $Date: 2010/09/17 10:08:30 $
 *
 * $Log: EventPublishTool.java,v $
 * Revision 1.5  2010/09/17 10:08:30  @author simplefan
 * *** empty log message ***
 *
 * Revision 1.4  2010/05/12 07:04:23  @author simplefan
 * *** empty log message ***
 *
 * Revision 1.3  2009/09/07 05:31:14  @author simplefan
 * *** empty log message ***
 *
 * Revision 1.2  2009/09/07 02:23:14  @author simplefan
 * *** empty log message ***
 *
 * Revision 1.1  2009/08/09 08:00:56  @author simplefan
 * *** empty log message ***
 *
 *
 *
 *********************************************************************/
/*
 * Copyright 2008 gxlu, Inc. All rights reserved.
 * File name : EventPublishTool.java
 * Created on : Jul 30, 2009 11:44:29 AM
 * Creator : lethe
 */
package com.simplefan.meta.eda;

import com.gxlu.mercury.MercuryPlatform;

/**
 * <pre>
 * Description : TODO
 * @author simplefan
 * </pre>
 */
public class EventPublishTool {

  private static EventPublishCenter publishCenter = (EventPublishCenter)MercuryPlatform.getBean("eventPublishCenter");

  public static void publish(Event event) {
    if(publishCenter == null) {
      publishCenter = (EventPublishCenter)MercuryPlatform.getBean("eventPublishCenter");
    }
    if(publishCenter!=null){
      publishCenter.publish(event);
    }
  }

  protected static void publishImmediate(Event event) {
    if(publishCenter == null) {
      publishCenter = (EventPublishCenter)MercuryPlatform.getBean("eventPublishCenter");
    }
    if(publishCenter!=null){
      publishCenter.publishImmediate(event);
    }
  }

  public static void subscribe(EventListener listener, EventType eventType) {
    publishCenter.subscribe(listener, eventType);
  }

  public static void unsubscribe(EventListener listener, EventType eventType) {
    publishCenter.unsubscribe(listener, eventType);
  }

}
